package cn.edu.gcu.PraticalTraining.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import cn.edu.gcu.PraticalTraining.interceptor.AuthInterceptor;

@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
    	
    }

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//添加拦截器
		AuthInterceptor authInterceptor = new AuthInterceptor();
		registry.addInterceptor(authInterceptor).addPathPatterns("/");
		registry.addInterceptor(authInterceptor).addPathPatterns("/propaganda/**");
		super.addInterceptors(registry);
	}
}